import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        for(int i=a;i<=b;i++){
            if(findNumber(i)){
                int num=i;
                int num1=i;
                int count=0;
                while(num>0){
                    num/=10;
                    count++;
                }
                if(count==1){
                    System.out.println(i);
                }else{
                    int cnt=1;
                    while(cnt<count) {
                        double aa = i / Math.pow(10, cnt);
                        double bb = i % Math.pow(10, cnt);
                        cnt++;
                        if(findNumber((int)aa)&&findNumber((int)bb)&&aa!=0&&bb!=0){
                            System.out.println(num1);
                            break;
                        }
                    }
                }
            }
        }
    }
    public static boolean findNumber(int num){
        if(Math.sqrt(num)==(int)Math.sqrt(num)){
            return true;
        }
        return false;
    }
}